<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <!-- 本地 引入 layui.css -->
    <link rel="stylesheet" href="/layui/css/layui.css">
    <!-- 本地 layui.js -->
    <script src="/layui/layui.js"></script>

    <script src="/js/jquery-3.3.1.js"></script>
</head>
<body>
<button  onclick="window1()">msg弹窗</button>
<button  onclick="window2()">警告弹窗</button>
<button  onclick="window3()">自定义弹窗</button>

<script>

    function window1() {
        // 导入 layer模块
        layui.use(["layer"],function(){
            var layer = layui.layer;
            layer.msg("hello world!!"); // 吐司
            // 有确认按钮的弹窗
            layer.msg("确定吗？",{btn:["确定！","放弃！"],
                    yes:function(i){
                        layer.close(i);// 关闭当前弹窗
                        layer.msg("yes!!!"); // 吐司一下
                    },
                    btn2:function(i){
                        layer.close(i);// 关闭当前弹窗
                        layer.msg("no!!!")

                    },
                    time: 5000 //5秒关闭（如果不配置，默认是3秒）

                }
            );
        });

    }

    function window2() {

        // 导入 layer模块
        layui.use(["layer"],function(){
            var layer = layui.layer;
            //0-6 7种图标  0:warning  1:success  2:error  3:question  4:lock  5:哭脸  6：笑脸
            layer.alert("alert弹框蓝",
                {title:'alert',icon:1 },
                function(){//点击“确定”按钮时的回调
                    layer.msg("好滴");
                }
            );
        });

    }

    function window3() {

        layui.use(["layer"],function(){
            layer = layui.layer;
            layer.open({
                type:1,// 消息框，没有确定按钮
                title:["hello","padding-left:5px"], // 标题，及标题样式
                content:layui.$("#testmain"), // dom格式 加载自定义布局
                offset:'auto',//可以在右下角显示
                shade:false //是否遮罩
            });

        });

    }

</script>

<div id="testmain" style="display:none;padding:10px; height: 173px; width: 275px;">
    hello world!

<form class="layui-form" action="">
    <div class="layui-form-item">
        <label class="layui-form-label">输入框</label>
        <div class="layui-input-block">
            <input type="text" name="title" required  lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">密码框</label>
        <div class="layui-input-inline">
            <input type="password" name="password" required lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">
        </div>
        <div class="layui-form-mid layui-word-aux">辅助文字</div>
    </div>



    <div class="layui-form-item">
        <label class="layui-form-label">单选框</label>
        <div class="layui-input-block">
            <input type="radio" name="sex" value="男" title="男">
            <input type="radio" name="sex" value="女" title="女" checked>
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">文本域</label>
        <div class="layui-input-block">
            <textarea name="desc" placeholder="请输入内容" class="layui-textarea"></textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <!--
                    事件标记  lay-filter="formDemo"
                    formDemo 相当一个信号
            -->
            <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
            <!-- 重置输入框-->
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>

</div>
</body>
</html>